package com.example.demo.config;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import com.example.demo.entity.User;

@Component
public class String2UserConvert implements Converter<String,User>{

	@Override
	public User convert(String info) {
		if(!info.contains("::"))
			return null;
		else {
			String[] split = info.split("::");
			return new User(split[0], Integer.valueOf(split[1]), 
					split[2].charAt(0), null);
		}
	}

}
